import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    redirect:'/layout/home'
  },
  {
    path:'/login',
    name:'login',
    component:()=>import('../views/login/login.vue')
  },
  {
    path:'/layout',
    name:'layout',
    component:()=>import('../views/layout/layout.vue'),
    children:[
      {
        path:'home',
        name:'home',
        component:()=>import('../views/home/home.vue')
      },
      {
        path:'user',
        name:'user',
        component:()=>import('../views/user/user.vue')
      }
    ]
  },
  {
    path:'/search',
    name:'search',
    component:()=>import('../views/search/search.vue')
  },
  {
    path:'/searchresult/:kw',
    name:'searchresult',
    component:()=>import('../views/search/searchResult.vue')
  },
  {
    path:'/detail',
    name:'articledetail',
    component:()=>import('../views/articleDetail/articleDetail.vue')
  },
  {
    path:'/useredit',
    name:'useredit',
    component:()=>import('../views/user/userEdit.vue')
  },
  {
    path:'/chat',
    name:'chat',
    component:()=>import('../views/chat/chat.vue')
  },
]

const router = new VueRouter({
  routes
})

export default router
